package com.lq.learningTest.JavaNewFunctions;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class StreamTest {
    public static void main(String[] args) {
        //把集合变为Stream
        ArrayList<User> arr = new ArrayList<>();
        Stream<User> stream = arr.stream();

        //把数组变为Stream
        int[] array = {1,3,4,5,4};
        IntStream stream1 = Arrays.stream(array);

        //合并Stream
        ArrayList<User> arr1 = new ArrayList<>();
        Stream<User> stream2 = arr1.stream();
        Stream<User> concat = Stream.concat(stream,stream2);

        //传入任意数据创建Stream
        Stream<String> a = Stream.of("a", "b", "c", "d");

        //生成随机数据流
        IntStream ints = new Random().ints(100);

    }
}
